import { Property } from "@/core/CodeGenerator"
import { EjsType } from "@/core/EjsCodeEncoder"
import { EjsVueComponent } from "@/core/EjsVueCodeGenerator"
import { ObjectEncoder, VueJsCodeEncoder } from "@/core/JsCodeEncoder"
import { ApplyMethodsParamItem, SinglePageVueComponentInterface, VueComponent } from "@/core/VueCodeGenerator"

export class LoadingVueComponent extends VueComponent {
	constructor(children: VueComponent[]) {
		super({
			vueComponentOptions: {
				name: 'Loading',
				tagName: 'a-spin',
				properties: [
						new Property(":spinning", "loading")
				]
			}, 
			children: children,
			vueJsCodeEncoder: new VueJsCodeEncoder().addMethod("data", [], new ObjectEncoder().addProperty("loading", "false"))
		})
	}
}

export class PageVueComponent extends VueComponent implements SinglePageVueComponentInterface {
	title: string
	apiMethods: ApplyMethodsParamItem[]
	constructor(children: VueComponent[]) {
		super({
			vueComponentOptions: {
				name: 'Page',
				tagName: 'page-header-wrapper'
			}, 
			children: children
		})
	}
}

export class EjsPageVueComponent extends EjsVueComponent  implements SinglePageVueComponentInterface {
	title: string
	apiMethods: ApplyMethodsParamItem[]
	constructor(template: string, type: EjsType = EjsType.TEXT_CONTENT) {
		super(template, type)
	}
}